/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package be.ugent.medirem.persistence.entity.details;

import be.ugent.medirem.persistence.util.DateFormatter;
import java.util.Date;

/**
 *
 * @author Simon
 */
public class PrescriptionDetails {

    private Long prescriptionId;
    private MedicationDetails medication;
    private GpDetails gp;
    private double frequency;
    private double dosageDosage;
    private boolean dosageIsFixed;
    private String dosageUnit;
    private Date startTime;
    private Date endTime;
    private String remarks;

    public PrescriptionDetails() {
        
    }

    public PrescriptionDetails(Long precriptionId, MedicationDetails m, GpDetails gp, double frequency,
            double dDosage, boolean dIsFixed, String dUnit, Date startTime, Date endTime, String remarks) {
        this.prescriptionId = precriptionId;
        this.medication = m;
        this.gp = gp;
        this.frequency = frequency;
        this.dosageDosage = dDosage;
        this.dosageIsFixed = dIsFixed;
        this.dosageUnit = dUnit;
        this.startTime = startTime;
        this.endTime = endTime;
        this.remarks = remarks;
    }
    
    public Long getPrescriptionId() {
        return prescriptionId;
    }

    public void setPrescriptionId(Long prescriptionId) {
        this.prescriptionId = prescriptionId;
    }

    /**
     * @return the gpId
     */
    public GpDetails getGp() {
        return gp;
    }

    /**
     * @param gpId the gpId to set
     */
    public void setGpId(GpDetails gp) {
        this.gp = gp;
    }

    /**
     * @return the frequency
     */
    public double getFrequency() {
        return frequency;
    }

    /**
     * @param frequency the frequency to set
     */
    public void setFrequency(double frequency) {
        this.frequency = frequency;
    }

    /**
     * @return the dosageDosage
     */
    public double getDosageDosage() {
        return dosageDosage;
    }

    /**
     * @param dosageDosage the dosageDosage to set
     */
    public void setDosageDosage(double dosageDosage) {
        this.dosageDosage = dosageDosage;
    }

    /**
     * @return the dosageIsFixed
     */
    public boolean isDosageIsFixed() {
        return dosageIsFixed;
    }

    /**
     * @param dosageIsFixed the dosageIsFixed to set
     */
    public void setDosageIsFixed(boolean dosageIsFixed) {
        this.dosageIsFixed = dosageIsFixed;
    }

    /**
     * @return the dosageUnit
     */
    public String getDosageUnit() {
        return dosageUnit;
    }

    /**
     * @param dosageUnit the dosageUnit to set
     */
    public void setDosageUnit(String dosageUnit) {
        this.dosageUnit = dosageUnit;
    }

    /**
     * @return the startTime
     */
    public Date getStartTime() {
        //return DateFormatter.format(startTime, "dd/MM/yy HH:mm");
        return startTime;
    }

    /**
     * @param startTime the startTime to set
     */
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    /**
     * @return the endTime
     */
    public Date getEndTime() {
        //return DateFormatter.format(endTime, "dd/MM/yy HH:mm");
        return endTime;
    }

    /**
     * @param endTime the endTime to set
     */
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    /**
     * @return the remarks
     */
    public String getRemarks() {
        return remarks;
    }

    /**
     * @param remarks the remarks to set
     */
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    /**
     * @return the medicationId
     */
    public MedicationDetails getMedication() {
        return medication;
    }

    /**
     * @param medicationId the medicationId to set
     */
    public void setMedication(MedicationDetails medication) {
        this.medication = medication;
    }

    public String toJson() {
        return "prescription:{dosage:"+dosageDosage+",fixed:"+dosageIsFixed+",unit:'"+dosageUnit+"',end_time:'"+
                DateFormatter.format(endTime, "d MMM yyyy HH:mm")+"',frequency:"+frequency+",medication:'"+medication.getName()+
                "',id:"+prescriptionId+",remarks:'"+remarks+"',start_time:'"+DateFormatter.format(startTime,"d MMM yyyy HH:mm")+"'}";
    }

}
